﻿@using System.Collections.ObjectModel;
@using BlueLotus7.SSQAnalysisCore;
@model ReadOnlyCollection<SSQMartixItem>
<table class="history">
    <thead>
        <tr>
            <th class="title"></th>
            @{
                for (int i = 1; i <= Constant.RedBallQuantity; i++)
                {
                <text>
                <th class="red">
                    @(i.ToString("00"))
                </th>
                </text>
                }
                for (int i = 1; i <= Constant.BlueBallQuantity; i++)
                {
                <text>
                <th class="blue">
                    @(i.ToString("00"))
                </th>
                </text>
                }
            }
        </tr>
    </thead>
    <tbody>
        @{
            if (Model != null)
            {
                foreach (var one in Model)
                {
            <text>
            <tr>
                <td class="title">
                    @(one.LotteryIdentity)
                </td>
                @{
                    /// Red balls
                    for (int i = 1; i <= Constant.RedBallQuantity; i++)
                    {
                        var value = one.RedBalls[i];
                        if (value == 0)
                        {
                    <text>
                    <td class="red-hit">
                        @(i.ToString("00"))
                    </td>
                    </text>
                        }
                        else
                        {
                    <text>
                    <td class="red">
                        @(((int)value).ToString())
                    </td>
                    </text>
                        }

                    }
                    /// Blue balls
                    for (int i = 1; i <= Constant.BlueBallQuantity; i++)
                    {
                        var value = one.BlueBalls[i];
                        if (value == 0)
                        {
                    <text>
                    <td class="blue-hit">
                        @(i.ToString("00"))
                    </td>
                    </text>
                        }
                        else
                        {
                    <text>
                    <td class="blue">
                        @(((int)value).ToString())
                    </td>
                    </text>
                        }
                    }                             
                }
            </tr>
            </text>
                }
            }
            else
            {
                for (int p = 0; p < BlueLotus7.SSQAnalyzeWebApplication.Constants.PageSize; p++)
                {
            <text>
            <tr>
                <td class="title"></td>
                @{
                    /// Red balls
                    for (int i = 1; i <= Constant.RedBallQuantity; i++)
                    {
                    <text>
                    <td class="red"></td>
                    </text>
                    }

                    /// Blue balls
                    for (int i = 1; i <= Constant.BlueBallQuantity; i++)
                    {
                    <text>
                    <td class="blue"></td>
                    </text>
                    }                             
                }
            </tr>
            </text>
                }
            }
        }
    </tbody>
</table>
